object DataModule1: TDataModule1
  OldCreateOrder = False
  OnCreate = DataModuleCreate
  Height = 553
  Width = 923
  object dlgprintsetup1: TPrinterSetupDialog
    Left = 40
    Top = 24
  end
  object cxStileRep1: TcxStyleRepository
    Left = 40
    Top = 80
    PixelsPerInch = 96
    object cxstyl1: TcxStyle
      AssignedValues = [svColor]
      Color = 15451300
    end
    object cxstyl2: TcxStyle
      AssignedValues = [svColor, svFont, svTextColor]
      Color = 16247513
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clBlack
      Font.Height = -11
      Font.Name = 'MS Sans Serif'
      Font.Style = []
      TextColor = clBlack
    end
    object cxstyl3: TcxStyle
      AssignedValues = [svColor, svTextColor]
      Color = 16247513
      TextColor = clBlack
    end
    object cxstyl4: TcxStyle
      AssignedValues = [svColor, svTextColor]
      Color = 16247513
      TextColor = clBlack
    end
    object cxstyl5: TcxStyle
      AssignedValues = [svColor, svTextColor]
      Color = 14811135
      TextColor = clBlack
    end
    object cxstyl6: TcxStyle
      AssignedValues = [svColor, svFont, svTextColor]
      Color = 14811135
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -11
      Font.Name = 'MS Sans Serif'
      Font.Style = [fsBold]
      TextColor = clNavy
    end
    object cxstyl7: TcxStyle
      AssignedValues = [svColor]
      Color = 14872561
    end
    object cxstyl8: TcxStyle
      AssignedValues = [svColor, svTextColor]
      Color = 4707838
      TextColor = clBlack
    end
    object cxstyl9: TcxStyle
      AssignedValues = [svColor, svFont, svTextColor]
      Color = 12937777
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -11
      Font.Name = 'MS Sans Serif'
      Font.Style = [fsBold]
      TextColor = clWhite
    end
    object cxstyl10: TcxStyle
      AssignedValues = [svColor]
      Color = 15451300
    end
    object cxstyl11: TcxStyle
      AssignedValues = [svColor, svTextColor]
      Color = 4707838
      TextColor = clBlack
    end
    object cxstyl12: TcxStyle
      AssignedValues = [svColor]
      Color = 15451300
    end
    object cxstyl13: TcxStyle
      AssignedValues = [svColor, svFont, svTextColor]
      Color = 14811135
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clNavy
      Font.Height = -11
      Font.Name = 'MS Sans Serif'
      Font.Style = [fsBold]
      TextColor = clNavy
    end
    object cxstyl14: TcxStyle
      AssignedValues = [svColor, svTextColor]
      Color = 12937777
      TextColor = clWhite
    end
    object cxStyleSheetTBVW1: TcxGridTableViewStyleSheet
      BuiltIn = True
    end
    object cxStyleSheetTBVWGridTableViewStyleSheetDevExpress: TcxGridTableViewStyleSheet
      Caption = 'DevExpress'
      Styles.Background = cxstyl1
      Styles.Content = cxstyl2
      Styles.ContentEven = cxstyl3
      Styles.ContentOdd = cxstyl4
      Styles.FilterBox = cxstyl5
      Styles.Inactive = cxstyl10
      Styles.IncSearch = cxstyl11
      Styles.Selection = cxstyl14
      Styles.Footer = cxstyl6
      Styles.Group = cxstyl7
      Styles.GroupByBox = cxstyl8
      Styles.Header = cxstyl9
      Styles.Indicator = cxstyl12
      Styles.Preview = cxstyl13
      BuiltIn = True
    end
  end
  object Connection: TZConnection
    AutoCommit = False
    Connected = True
    DesignConnection = True
    SQLHourGlass = True
    Protocol = 'postgresql-8'
    HostName = 'localhost'
    Port = 5432
    Database = 'Controlplan'
    User = 'postgres'
    Password = '1234'
    Left = 112
    Top = 24
  end
  object xpmnfst1: TXPManifest
    Left = 168
    Top = 24
  end
  object qryGeral: TZQuery
    Connection = Connection
    Params = <>
    Left = 112
    Top = 72
  end
  object seqAuditoria: TZSequence
    Connection = Connection
    SequenceName = 'public.seqauditoria'
    Left = 184
    Top = 80
  end
  object qryEventos: TZQuery
    Connection = Connection
    Active = True
    SQL.Strings = (
      'select * from auditoria order by hora limit(30)')
    Params = <>
    Left = 304
    Top = 80
    object intgrfldEventoscod_auditoria: TIntegerField
      FieldName = 'cod_auditoria'
      Required = True
    end
    object intgrfldEventoscod_usuario: TIntegerField
      FieldName = 'cod_usuario'
    end
    object wdstrngfldEventosevento: TWideStringField
      FieldName = 'evento'
      Size = 50
    end
    object wdstrngfldEventosdetalheevento: TWideStringField
      FieldName = 'detalheevento'
      Size = 512
    end
    object dtmfldEventoshora: TDateTimeField
      FieldName = 'hora'
    end
  end
  object dsEventos: TDataSource
    DataSet = qryEventos
    Left = 376
    Top = 80
  end
  object tblClientes: TZTable
    Connection = Connection
    SortedFields = 'nome'
    Active = True
    TableName = 'public.clientes'
    IndexFieldNames = 'nome Asc'
    Left = 112
    Top = 160
    object tblClientescod_cliente: TIntegerField
      FieldName = 'cod_cliente'
      Required = True
    end
    object tblClientesnome: TWideStringField
      FieldName = 'nome'
      Size = 80
    end
    object tblClientesendereco: TWideStringField
      FieldName = 'endereco'
      Size = 200
    end
    object tblClientescidade: TWideStringField
      FieldName = 'cidade'
      Size = 80
    end
    object tblClientesfonecel: TWideStringField
      FieldName = 'fonecel'
    end
    object tblClientesfone: TWideStringField
      FieldName = 'fone'
    end
    object tblClientesrg: TWideStringField
      FieldName = 'rg'
    end
    object tblClientessexo: TWideStringField
      FieldName = 'sexo'
    end
    object tblClientesdatanascimento: TDateTimeField
      FieldName = 'datanascimento'
    end
    object tblClientesstatus: TWideStringField
      FieldName = 'status'
    end
    object tblClientesobservacoes: TMemoField
      FieldName = 'observacoes'
      BlobType = ftMemo
    end
    object tblClientescpf: TWideStringField
      FieldName = 'cpf'
      Size = 11
    end
    object wdstrngfldClientesbairro: TWideStringField
      FieldName = 'bairro'
      Size = 256
    end
  end
  object dsContrato: TDataSource
    DataSet = zqryContrato
    Left = 448
    Top = 152
  end
  object dsClientes: TDataSource
    DataSet = tblClientes
    Left = 112
    Top = 216
  end
  object tblParcelas: TZTable
    Connection = Connection
    ReadOnly = True
    TableName = 'public.parcelascontrato'
    MasterFields = 'cod_contrato'
    MasterSource = dsContrato
    LinkedFields = 'cod_contrato'
    Left = 264
    Top = 160
    object intgrfldParcelascod_parcelacontrato: TIntegerField
      FieldName = 'cod_parcelacontrato'
      Required = True
    end
    object intgrfldParcelascod_contrato: TIntegerField
      FieldName = 'cod_contrato'
    end
    object dtmfldParcelasdata_emissao: TDateTimeField
      FieldName = 'data_emissao'
    end
    object dtmfldParcelasdata_vencimento: TDateTimeField
      FieldName = 'data_vencimento'
    end
    object dtmfldParcelasdata_pagto: TDateTimeField
      FieldName = 'data_pagto'
    end
    object fltfldParcelasvalor_parcela: TFloatField
      FieldName = 'valor_parcela'
      currency = True
    end
    object fltfldParcelasdesconto: TFloatField
      FieldName = 'desconto'
      currency = True
    end
    object mfldParcelasstatus: TMemoField
      FieldName = 'status'
      BlobType = ftMemo
    end
    object fltfldParcelasacrescimo: TFloatField
      FieldName = 'acrescimo'
      currency = True
    end
  end
  object tblDependentes: TZTable
    Connection = Connection
    ReadOnly = True
    TableName = 'public.dependentes'
    MasterFields = 'cod_cliente'
    MasterSource = dsClientes
    LinkedFields = 'cod_cliente'
    Left = 344
    Top = 160
  end
  object dsDependentes: TDataSource
    DataSet = tblDependentes
    Left = 344
    Top = 216
  end
  object dsParcelas: TDataSource
    DataSet = tblParcelas
    Left = 256
    Top = 216
  end
  object zqryContrato: TZQuery
    Connection = Connection
    Active = True
    ReadOnly = True
    SQL.Strings = (
      'select '
      '       c.cod_contrato,'
      '       c.cod_cliente,'
      '       c.data_assinatura,'
      '       c.data_inicio,'
      '       c.data_final,'
      '       p.nomeplano,'
      '       c.valor_parcela_final,'
      '       c.status,'
      '       c.tem_falecido'
      'from contratos c'
      '     join planos p on p.cod_plano = c.cod_plano')
    Params = <>
    MasterFields = 'cod_cliente'
    MasterSource = dsClientes
    LinkedFields = 'cod_cliente'
    Left = 440
    Top = 80
    object intgrfldContratocod_contrato: TIntegerField
      FieldName = 'cod_contrato'
      Required = True
    end
    object intgrfldContratocod_cliente: TIntegerField
      FieldName = 'cod_cliente'
      Required = True
    end
    object dtmfldContratodata_assinatura: TDateTimeField
      FieldName = 'data_assinatura'
    end
    object dtmfldContratodata_inicio: TDateTimeField
      FieldName = 'data_inicio'
    end
    object dtmfldContratodata_final: TDateTimeField
      FieldName = 'data_final'
    end
    object wdstrngfldContratonomeplano: TWideStringField
      FieldName = 'nomeplano'
      Size = 256
    end
    object fltfldContratovalor_parcela_final: TFloatField
      FieldName = 'valor_parcela_final'
      currency = True
    end
    object wdstrngfldContratostatus: TWideStringField
      FieldName = 'status'
    end
    object blnfldContratotem_falecido: TBooleanField
      FieldName = 'tem_falecido'
    end
  end
  object tblDependentes2: TZTable
    Connection = Connection
    Active = True
    TableName = 'public.dependentes'
    Left = 576
    Top = 40
    object tblDependentes2cod_dependente: TIntegerField
      FieldName = 'cod_dependente'
      Required = True
    end
    object tblDependentes2cod_cliente: TIntegerField
      FieldName = 'cod_cliente'
    end
    object tblDependentes2cpf: TWideStringField
      FieldName = 'cpf'
      Size = 11
    end
    object tblDependentes2nome: TWideStringField
      FieldName = 'nome'
      Size = 256
    end
    object tblDependentes2sexo: TWideStringField
      FieldName = 'sexo'
      Size = 10
    end
    object tblDependentes2datanascimento: TDateTimeField
      FieldName = 'datanascimento'
    end
    object tblDependentes2parentesco: TWideStringField
      FieldName = 'parentesco'
      Size = 256
    end
    object tblDependentes2status: TWideStringField
      FieldName = 'status'
    end
    object tblDependentes2observacao: TMemoField
      FieldName = 'observacao'
      BlobType = ftMemo
    end
    object tblDependentes2causa_falecimento: TWideStringField
      FieldName = 'causa_falecimento'
      Size = 256
    end
    object tblDependentes2data_falecimento: TDateTimeField
      FieldName = 'data_falecimento'
    end
  end
  object dsDependentes2: TDataSource
    DataSet = tblDependentes2
    Left = 672
    Top = 40
  end
  object dsClientes2: TDataSource
    DataSet = tblClientes2
    Left = 576
    Top = 112
  end
  object tblClientes2: TZTable
    Connection = Connection
    Active = True
    TableName = 'public.clientes'
    Left = 672
    Top = 112
  end
  object qryClienteContrato: TZQuery
    Connection = Connection
    Active = True
    SQL.Strings = (
      
        'select cl.nome, co.cod_contrato, co.data_final, pl.nomeplano , c' +
        'ount (pc.*) as "Em Aberto"'
      '   from clientes cl'
      '    join contratos co on cl.cod_cliente = co.cod_cliente'
      '    join planos pl on co.cod_plano = pl.cod_plano     '
      
        #9'join parcelascontrato pc on pc.cod_contrato = co.cod_contrato a' +
        'nd pc.status= '#39'ABERTO'#39
      #9'group by cl.nome, co.cod_contrato, co.data_final, pl.nomeplano ')
    Params = <>
    Left = 576
    Top = 240
    object wdstrngfldClienteContratonome: TWideStringField
      FieldName = 'nome'
      Size = 80
    end
    object intgrfldClienteContratocod_contrato: TIntegerField
      FieldName = 'cod_contrato'
      Required = True
    end
    object dtmfldClienteContratodata_final: TDateTimeField
      FieldName = 'data_final'
    end
    object wdstrngfldClienteContratonomeplano: TWideStringField
      FieldName = 'nomeplano'
      Size = 256
    end
    object qryClienteContratoEmAberto: TLargeintField
      FieldName = 'Em Aberto'
      ReadOnly = True
    end
  end
  object dsClientesContrato: TDataSource
    DataSet = qryClienteContrato
    Left = 572
    Top = 184
  end
  object dsParcelasRecebimentos: TDataSource
    DataSet = tblParcelasRecebimentos
    Left = 704
    Top = 288
  end
  object tblParcelasRecebimentos: TZTable
    Connection = Connection
    Active = True
    TableName = 'public.parcelascontrato'
    MasterFields = 'cod_contrato'
    MasterSource = dsClientesContrato
    LinkedFields = 'cod_contrato'
    Left = 568
    Top = 304
    object intgrfldParcelasRecebimentoscod_parcelacontrato: TIntegerField
      FieldName = 'cod_parcelacontrato'
      Required = True
    end
    object intgrfldParcelasRecebimentoscod_contrato: TIntegerField
      FieldName = 'cod_contrato'
    end
    object dtmfldParcelasRecebimentosdata_emissao: TDateTimeField
      FieldName = 'data_emissao'
    end
    object dtmfldParcelasRecebimentosdata_vencimento: TDateTimeField
      FieldName = 'data_vencimento'
    end
    object dtmfldParcelasRecebimentosdata_pagto: TDateTimeField
      FieldName = 'data_pagto'
    end
    object fltfldParcelasRecebimentosvalor_parcela: TFloatField
      FieldName = 'valor_parcela'
      currency = True
    end
    object fltfldParcelasRecebimentosdesconto: TFloatField
      FieldName = 'desconto'
      currency = True
    end
    object mfldParcelasRecebimentosstatus: TMemoField
      FieldName = 'status'
      BlobType = ftMemo
    end
    object fltfldParcelasRecebimentosacrescimo: TFloatField
      FieldName = 'acrescimo'
      currency = True
    end
  end
  object qryClienteDespesas: TZQuery
    Connection = Connection
    SQL.Strings = (
      'select pd.*, s.tiposervico '
      'from clientes cl'
      '     join contratos co on cl.cod_cliente = co.cod_cliente'
      
        '     join parcelasdespesas pd on co.cod_contrato = pd.cod_contra' +
        'to'
      '     join servicos s on pd.cod_servico = s.codservico')
    Params = <>
    MasterFields = 'cod_contrato'
    MasterSource = dsClientesContrato
    LinkedFields = 'cod_contrato'
    Left = 448
    Top = 256
    object intgrfldClienteDespesascod_parceladespesa: TIntegerField
      FieldName = 'cod_parceladespesa'
      Required = True
    end
    object intgrfldClienteDespesascod_contrato: TIntegerField
      FieldName = 'cod_contrato'
    end
    object intgrfldClienteDespesascod_servico: TIntegerField
      FieldName = 'cod_servico'
    end
    object dtmfldClienteDespesasdata_emissao: TDateTimeField
      FieldName = 'data_emissao'
    end
    object dtmfldClienteDespesasdata_vencimento: TDateTimeField
      FieldName = 'data_vencimento'
    end
    object dtmfldClienteDespesasdata_pagto: TDateTimeField
      FieldName = 'data_pagto'
    end
    object fltfldClienteDespesasvalor_parcela: TFloatField
      FieldName = 'valor_parcela'
      currency = True
    end
    object wdstrngfldClienteDespesasstatus: TWideStringField
      FieldName = 'status'
      Size = 30
    end
    object wdstrngfldClienteDespesastiposervico: TWideStringField
      FieldName = 'tiposervico'
      Size = 60
    end
  end
  object dsClienteDespesas: TDataSource
    DataSet = qryClienteDespesas
    Left = 344
    Top = 328
  end
  object qryClientesParcelas: TZQuery
    Connection = Connection
    Params = <>
    Left = 672
    Top = 184
  end
  object tblContratos: TZTable
    Connection = Connection
    SortedFields = 'nome_responsavel'
    Active = True
    TableName = 'public.contratos'
    IndexFieldNames = 'nome_responsavel Asc'
    Left = 48
    Top = 408
    object intgrfldContratoscod_contrato: TIntegerField
      FieldName = 'cod_contrato'
      Required = True
    end
    object intgrfldContratoscod_cliente: TIntegerField
      FieldName = 'cod_cliente'
      Required = True
    end
    object intgrfldContratoscod_plano: TIntegerField
      FieldName = 'cod_plano'
      Required = True
    end
    object wdstrngfldContratosnome_responsavel: TWideStringField
      FieldName = 'nome_responsavel'
      Size = 80
    end
    object wdstrngfldContratoscpf_contratante: TWideStringField
      FieldName = 'cpf_contratante'
      Size = 11
    end
    object dtmfldContratosdata_assinatura: TDateTimeField
      FieldName = 'data_assinatura'
    end
    object dtmfldContratosdata_emissao: TDateTimeField
      FieldName = 'data_emissao'
    end
    object dtmfldContratosdata_inicio: TDateTimeField
      FieldName = 'data_inicio'
    end
    object dtmfldContratosdata_final: TDateTimeField
      FieldName = 'data_final'
    end
    object dtmfldContratosdata_cancelamento: TDateTimeField
      FieldName = 'data_cancelamento'
    end
    object wdstrngfldContratosmotivo_cancelmento: TWideStringField
      FieldName = 'motivo_cancelmento'
      Size = 80
    end
    object intgrfldContratosdia_cobranca: TIntegerField
      FieldName = 'dia_cobranca'
      ReadOnly = True
    end
    object fltfldContratosdesconto: TFloatField
      FieldName = 'desconto'
      currency = True
    end
    object fltfldContratosvalor_total: TFloatField
      FieldName = 'valor_total'
      currency = True
    end
    object fltfldContratosvalor_parcela: TFloatField
      FieldName = 'valor_parcela'
      currency = True
    end
    object fltfldContratosvalor_total_final: TFloatField
      FieldName = 'valor_total_final'
      currency = True
    end
    object fltfldContratosvalor_parcela_final: TFloatField
      FieldName = 'valor_parcela_final'
      currency = True
    end
    object fltfldContratosvalor_acrescentado: TFloatField
      FieldName = 'valor_acrescentado'
      currency = True
    end
    object intgrfldContratosqtd_dependentes: TIntegerField
      FieldName = 'qtd_dependentes'
    end
    object intgrfldContratosqtd_parcelas: TIntegerField
      FieldName = 'qtd_parcelas'
    end
    object wdstrngfldContratosstatus: TWideStringField
      FieldName = 'status'
    end
    object blnfldContratostem_falecido: TBooleanField
      FieldName = 'tem_falecido'
    end
    object intgrfldContratosqtd_idosos: TIntegerField
      FieldName = 'qtd_idosos'
    end
  end
  object dsContratos: TDataSource
    DataSet = tblContratos
    Left = 120
    Top = 408
  end
  object dsPlanos: TDataSource
    DataSet = tblPlanos
    Left = 120
    Top = 472
  end
  object tblPlanos: TZTable
    Connection = Connection
    Active = True
    ReadOnly = True
    TableName = 'public.planos'
    Left = 48
    Top = 472
    object intgrfldPlanoscod_plano: TIntegerField
      FieldName = 'cod_plano'
      Required = True
    end
    object wdstrngfldPlanosnomeplano: TWideStringField
      FieldName = 'nomeplano'
      Size = 256
    end
    object fltfldPlanosvalor_mensal: TFloatField
      FieldName = 'valor_mensal'
    end
    object intgrfldPlanosqtd_dependente: TIntegerField
      FieldName = 'qtd_dependente'
    end
    object fltfldPlanosacr_dependente: TFloatField
      FieldName = 'acr_dependente'
    end
    object fltfldPlanosacr_idade: TFloatField
      FieldName = 'acr_idade'
    end
    object intgrfldPlanosduracao: TIntegerField
      FieldName = 'duracao'
    end
    object intgrfldPlanoscarencia: TIntegerField
      FieldName = 'carencia'
    end
    object fltfldPlanosvalor_total: TFloatField
      FieldName = 'valor_total'
    end
  end
  object tblDespesas: TZTable
    Connection = Connection
    Active = True
    ReadOnly = True
    TableName = 'public.parcelasdespesas'
    MasterFields = 'cod_contrato'
    MasterSource = dsContrato
    LinkedFields = 'cod_contrato'
    Left = 232
    Top = 312
    object intgrfldZTable1cod_parceladespesa: TIntegerField
      FieldName = 'cod_parceladespesa'
      Required = True
    end
    object intgrfldZTable1cod_contrato: TIntegerField
      FieldName = 'cod_contrato'
    end
    object intgrfldZTable1cod_servico: TIntegerField
      FieldName = 'cod_servico'
    end
    object dtmfldZTable1data_emissao: TDateTimeField
      FieldName = 'data_emissao'
    end
    object dtmfldZTable1data_vencimento: TDateTimeField
      FieldName = 'data_vencimento'
    end
    object dtmfldZTable1data_pagto: TDateTimeField
      FieldName = 'data_pagto'
    end
    object fltfldZTable1valor_parcela: TFloatField
      FieldName = 'valor_parcela'
    end
    object wdstrngfldZTable1status: TWideStringField
      FieldName = 'status'
      Size = 30
    end
  end
  object dsDespesas: TDataSource
    DataSet = tblDespesas
    Left = 224
    Top = 368
  end
end
